package web;

import pojo.User;
import service.UserService;

import java.sql.SQLException;

//web层:接受客户端发送的数据,数据封装为对象,调用service层方法,基于service层方法执行结果返回结果给客户端
public class LoginTest {
   public void login() throws SQLException {
      //模拟客户端发送的数据
      String loginName="张三";
      String loginPassword="1234";

      //把数据封装为对象
      User user = new User();
      user.setUserName(loginName);
      user.setUserPassword(loginPassword);

      //调用service层方法
      UserService userService = new UserService();
      Boolean loginResult = userService.UserLogin(user);

      //基于service层方法执行结果返回结果给客户端
      if (loginResult){
         System.out.println("登录成功");
      }else{
         System.out.println("登录失败");
      }
   }
}
